package org.shj.basic

object Direction extends Enumeration{
  //定义枚举方式一：
  val East, West, North, Sourth = Value
  
  //定义枚举方式二：
  /*val East = Value("East")
  val West = Value("West")
  val North = Value("North")
  val South = Value("South")*/
}

object EnumerationDemo {
  def main(args: Array[String]): Unit = {
    val east = Direction.East
    
    if(Direction.East.id == east.id){ //通过ID来比较
      println("111")
    }
    
    for(d <- Direction.values)
      print(d + " ")
    
      
  }
}